package qldc.pm.tiensu.searchcontainer.util.yeucautrichluc;

import qldc.pm.tiensu.model.YeuCauTrichLuc;

import com.liferay.portal.kernel.util.OrderByComparator;

public class HoVaTenDoiTuongTrichLucComparator extends OrderByComparator {

	/**
	 *
	 */
	private static final long serialVersionUID = 1L;

	public static String ORDER_BY_ASC = "hoVaTenDoiTuongTrichLuc ASC";
	public static String ORDER_BY_DESC = "hoVaTenDoiTuongTrichLuc DESC";

	private final boolean _asc;

	public HoVaTenDoiTuongTrichLucComparator() {
		this(false);
	}

	public HoVaTenDoiTuongTrichLucComparator(boolean asc) {
		this._asc = asc;
	}

	@Override
	public int compare(Object obj1, Object obj2) {
		YeuCauTrichLuc yeuCauTrichLuc1 =(YeuCauTrichLuc) obj1;
		YeuCauTrichLuc yeuCauTrichLuc2 =(YeuCauTrichLuc) obj2;

		int value = yeuCauTrichLuc1.getHoVaTenDoiTuongTrichLuc().compareTo(yeuCauTrichLuc2.getHoVaTenDoiTuongTrichLuc());

		if (this.equals(_asc)) {
			return value;
		} else {
			return -value;
		}
	}

	@Override
	public String getOrderBy(){
		if (_asc) {
			return ORDER_BY_ASC;
		} else {
			return ORDER_BY_DESC;
		}
	}

}
